package com.tao.YanMoDesignPattern.Order.case2_Computer;



/**
 * @Author Mi_Tao
 * @Date 2023/8/26
 * @Description 装机 将主板和机箱组装起来
 * @Version 1.0
 **/
public class Client {

	public static void main(String[] args){
        // 1、把命令和真正的实现组合起来，相当于在组装机器
        // 把机箱上按钮的连接线插接到主板上
//        MainBoardApi mainBoard = new GigaMainBoard();
        MainBoardApi mainBoard = new WeixMainBoard();
        // 创建开机命令
        OpenCommand openCommand = new OpenCommand(mainBoard);
        // 创建关机命令
        ResetCommand resetCommand = new ResetCommand(mainBoard);

        // 为机箱上的按钮设置命令，让按钮知道要干嘛
        Box box = new Box();
        box.setCommand(openCommand);
        box.setResetCommand(resetCommand);

        System.out.println("-------开机--------");
        box.openButtonPressd();
        System.out.println("-------关机--------");
        box.resetButtonPressd();
        System.out.println("错误配置一会，开机跟关机颠倒");
        box.setCommand(resetCommand);
        box.setResetCommand(openCommand);
        System.out.println("-------开机--------");
        box.openButtonPressd();
        System.out.println("-------关机--------");
        box.resetButtonPressd();
    }
}
